/**
 * @param {number} n
 * @return {number}
 */
var climbStairs = function (n) {
  const memo = []
  memo[1] = 1
  memo[2] = 2
  // 1,2
  // 1,1,1/2,1
  // 3 = memo[1] + memo[2]
  for (let i = 3; i <= n; i++) { //循环n次
    memo[i] = memo[i - 2] + memo[i - 1] //每一次是前两次的和
  }
  return memo[n]
};